package main

import "fmt"

//for循环
func main() {
	sum := 0
	for i := 0; i <= 10; i++ {
		sum += i
	}
	fmt.Println(sum)
	n := 1
	for n <= 10 {
		n += sum
	}
	fmt.Println(n)
	//这样写更像while语句
	for n <= 10 {
		n += n
	}
	fmt.Println(n)

	strings := []string{"google", "runoob"}
	for i, s := range strings {
		fmt.Println(i, s)
	}

	numbers := [6]int{1, 2, 3, 5}
	for i, x := range numbers {
		fmt.Printf("第 %d 位 x 的值 = %d\n", i, x)
	}

}
